// car车辆相关
import { post } from '@/api/http'

//车辆品牌
const car_brand = {
  // saas系统的标准库-品牌
  car_brand_saasList: {
    label: 'brandName',
    keyword: 'brandName',
    key: 'id',
    mode: 'each',
    data: {
      status: 1, // 可用的
    },
    api: (data: any) => post({ url: '/carModel/searchCarBrand', data }),
  },
  // 企业查询品牌模糊查询
  search_car_brand: {
    label: 'brandName',
    keyword: 'brandName',
    key: 'id',
    mode: 'each',
    data: {
      status: 1, // 可用的
    },
    api: (data: any) => post({ url: '/carModelTenant/searchCarBrand', data }),
  },
  // 企业查询品牌模糊查询
  search_car_series: {
    label: 'seriesName',
    keyword: 'seriesName',
    key: 'id',
    mode: 'each',
    data: {
      status: 1, // 可用的
    },
    api: (data: any) => post({ url: '/carModel/searchCarSeries', data }),
  },
}

// 车系
const car_series = {
  // saas系统的标准库-车系
  car_series_saasList: {
    label: 'seriesName',
    keyword: 'seriesName',
    key: 'id',
    mode: 'each',
    data: {
      status: 1, // 可用的
    },
    api: (data: any) => post({ url: '/carModel/searchCarSeries', data }),
  },
  // 商户关联的-车系
  car_model_tenant_carList: {
    label: 'seriesName',
    keyword: 'seriesName',
    key: 'id',
    mode: 'each',
    data: {
      status: 1, // 可用的
    },
    api: (data: any) => post({ url: '/carModelTenant/searchCarSeries', data }),
  },
  // 商户关联的-车系
  multiple_carSeries_bySite: {
    label: 'seriesName',
    keyword: 'seriesName',
    key: 'id',
    mode: 'multiple',
    data: {
      status: 1, // 可用的
    },
    api: (data: any) => post({ url: '/carModelSite/searchCarSeries', data }),
  },
  // 车系-多选
  car_series_multiple: {
    label: 'seriesName',
    keyword: 'seriesName',
    key: 'id',
    mode: 'multiple',
    data: {
      status: 1, // 可用的
    },
    api: (data: any) => post({ url: '/carModelTenant/searchCarSeries', data }),
  },
}

// 车型
const car_model = {
  // saas系统的标准库-车型
  car_model_saasList: {
    label: 'modelName',
    keyword: 'modelName',
    key: 'id',
    mode: 'each',
    data: {
      status: 1, // 可用的
    },
    api: (data: any) => post({ url: '/carModel/searchCarModel', data }),
  },
  // saas系统的标准库-车型_多选
  car_model_saasList_multiple: {
    label: 'modelName',
    keyword: 'modelName',
    key: 'id',
    mode: 'multiple',
    data: {
      status: 1, // 可用的
    },
    api: (data: any) => post({ url: '/carModel/searchCarModel', data }),
  },
  // 商户-车型
  car_model_tenantList: {
    label: 'modelName',
    keyword: 'modelName',
    key: 'id',
    mode: 'each',
    data: {
      status: 1, // 可用的
    },
    api: (data: any) => post({ url: '/carModelTenant/searchCarModel', data }),
  },
  // 商户-车型-多选
  car_model_tenantList_multiple: {
    label: 'modelName',
    keyword: 'modelName',
    key: 'id',
    mode: 'multiple',
    data: {
      status: 1, // 可用的
    },
    api: (data: any) => post({ url: '/carModelTenant/searchCarModel', data }),
  },
  // 商户-门店下的车型
  car_model_listBySite: {
    label: 'modelName',
    keyword: 'modelName',
    key: 'id',
    mode: 'each',
    data: {
      status: 1, // 可用的
    },
    api: (data: any) => post({ url: '/carModelSite/searchCarModel', data }),
  },
  // 多选-商户-门店下的车型
  multiple_car_model_bySite: {
    label: 'modelName',
    keyword: 'modelName',
    key: 'id',
    mode: 'multiple',
    data: {
      status: 1, // 可用的
    },
    api: (data: any) => post({ url: '/carModelSite/searchCarModel', data }),
  },
  // 车型价格模板
  multiple_tenantPriceTemplate: {
    label: 'templateName',
    keyword: 'templateNameLike',
    key: 'id',
    mode: 'multiple',
    data: {
      templateSort: 1, // 短租
    },
    api: (data: any) => post({ url: '/tenantPriceTemplate/selectList', data }),
  },
  car_model_multiple: {
    label: 'modelName',
    keyword: 'modelName',
    key: 'id',
    mode: 'multiple',
    data: {
      status: 1, // 可用的
    },
    api: (data: any) => post({ url: '/carModelTenant/searchCarModel', data }),
  },
}

// 车机
const car_vehicle = {
  car_vehicle_list: {
    label: 'vehicleSelectStr',
    keyword: 'vehicleAddUnionLike',
    key: 'id',
    mode: 'each',
    api: (data: any) => post({ url: '/carVehicle/getList', data }),
  },
}

// 车牌
const car_licenseno = {
  car_licenseno_list: {
    label: 'licenseNo',
    keyword: 'licenseNoLike',
    key: 'id',
    mode: 'each',
    data: {
      pageNumber: 1,
      pageSize: 100,
    },
    api: (data: any) => post({ url: '/carInfo/getLicenseNoLike', data }),
  },
  multiple_carLicensenno_bySite: {
    label: 'licenseNo',
    keyword: 'licenseNoLike',
    key: 'id',
    mode: 'multiple',
    data: {
      pageNumber: 1,
      pageSize: 100,
    },
    api: (data: any) => post({ url: '/carInfo/getLicenseNoLike', data }),
  },
  // 【多选】车牌(车辆)列表
  multiple_car_licensenno_list: {
    label: 'licenseNo',
    keyword: 'licenseNo',
    key: 'id',
    mode: 'multiple',
    data: {
      pageNumber: 1,
      pageSize: 100,
    },
    api: (data: any) => post({ url: '/carInfo/getLicenseNo', data }),
  },
}

// 负责人
const store_staff = {
  store_staff_list: {
    label: 'realname',
    keyword: 'likeRealname',
    key: 'id',
    mode: 'each',
    tag: 'staff',
    api: (data: any) => post({ url: '/staff/selectStaffByOrgId', data }),
  },
}

// 负责人 多选
const store_staff_multiple = {
  store_staff_list_multiple: {
    label: 'realname',
    keyword: 'likeRealname',
    key: 'id',
    mode: 'multiple',
    tag: 'staff',
    api: (data: any) => post({ url: '/staff/selectStaffByOrgId', data }),
  },
  store_staff_useId_multiple: {
    label: 'realname',
    keyword: 'likeRealname',
    key: 'userId',
    mode: 'multiple',
    tag: 'staff',
    api: (data: any) => post({ url: '/staff/selectStaffByOrgId', data }),
  },
}

// 供应商
const supplier_list = {
  supplier_list: {
    label: 'supplierName',
    keyword: 'supplierName',
    key: 'id',
    mode: 'each',
    api: (data: any) => post({ url: '/supplier/findList', data }),
  },
}

// 供应商 多选
const supplier_list_multiple = {
  supplier_list_multiple: {
    label: 'supplierName',
    keyword: 'supplierName',
    key: 'id',
    mode: 'multiple',
    api: (data: any) => post({ url: '/supplier/findList', data }),
  },
}

// 业务单类型
const order_list = {
  order_list: {
    label: 'name',
    keyword: 'name',
    key: 'value',
    mode: 'each',
    api: (data: any) =>
      new Promise((resolve, reject) => {
        post({ url: '/warning/supplierPageData', data }).then((res: any) => {
          if (res.code === 200) {
            resolve({
              code: res.code,
              message: res.message,
              reqId: res.reqId,
              result: res.result.supplierTypeList,
              timeStamp: res.timeStamp,
            })
          } else {
            reject(res)
          }
        })
      }),
  },
}

//工作台-同行
const sameIndustry_list = {
  sameIndustry_list: {
    label: 'industryName',
    keyword: 'industryName',
    key: 'id',
    mode: 'each',
    api: (data: any) => post({ url: '/sameIndustryInfo/getList', data }),
  },
}

//工作台页面枚举-收支类型
const getEnum_list = {
  getEnum_list: {
    label: 'name',
    keyword: 'name',
    key: 'value',
    mode: 'each',
    api: (data: any) => post({ url: '/warning/getEnum', data }),
  },
}

//借调 - 员工权限门店下车型模糊查询
const car_transfer = {
  car_model_by_staff_list: {
    label: 'modelName',
    keyword: 'modelName',
    key: 'id',
    mode: 'each',
    api: (data: any) => post({ url: '/carModelSite/searchCarModelForStaff', data }),
  },
  //借调管理  获取车牌号(权限)
  car_transfer_car_by_site: {
    label: 'licenseNo',
    keyword: 'licenseNoLike',
    key: 'id',
    mode: 'each',
    api: (data: any) => post({ url: '/carInfo/getLicenseNoLikeNotAuth', data }),
  },
}

export default {
  ...car_brand,
  ...car_series,
  ...car_model,
  ...car_vehicle,
  ...car_licenseno,
  ...store_staff,
  ...store_staff_multiple,
  ...supplier_list,
  ...supplier_list_multiple,
  ...sameIndustry_list,
  ...getEnum_list,
  ...car_transfer,
  ...order_list,
}
